<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>商品评价</title>
  <meta name="renderer" content="webkit"/>
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
    <form action="{:url('User/post_comment')}" enctype="multipart/form-data" method="post">
        <textarea name="content" placeholder="评论内容" id="content"></textarea><br/>
        <input type="file" name="images" /> <br>
        <input type="checkbox" name="is_anonymous" value="1">是否匿名<br/>
        <input type="submit" value="提交" >
        <!--<input type="submit" value="提交" onclick="checkform();">-->
        <input type="hidden" name="id" value="{$id}">
    </form>
</body>
</html>
<script>
    /**
     * 提交
     */
    function checkform(){
        var content = $('#content').val();
        var id = $('input[name=id]').val();
        var images = $('input[name=images]').val();
        if(content == ''){
            alert('请输入评价内容');
            return false;
        }
        //提交
        $.post("{:url('User/post_comment')}",
              {id:id,images:images,content:content},
              function(data){
                  if(data.code){
                      alert('成功');
                  }else{
                      alert('失败');
                  }
              }
        );
    }
</script>
